<?php
class MysqlClass {
    public static  $default_config=[
        'host' =>"106.12.90.200", 
        'port' =>"3306", 
        'user' =>"root", 
        'password' =>"4aJ35nAEWyWxTKNn", 
        'database' =>"qun" 
    ];
    public static function getInstance($params=null){
        $config=$params?:self::$default_config;
        $host=$config["host"];
        $database=$config["database"];
        $user=$config["user"];
        $password=$config["password"];
        $dsn="mysql:host=$host;dbname=$database";
        try{
            $pdo_obj=new PDO($dsn,$user,$password);
        }catch(\PDOException  $e){
            $return_data=[
                "status"=>0,
                "msg"=>$e->getMessage
            ];
            die(json_encode($return_data));
        }
        return $pdo_obj;
    }
}